package com.kornero.geek.activity.intro;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;
import com.kornero.geek.R;
import com.kornero.geek.activity.game.MainActivity;

public class EnterNewPlayerNameActivity extends Activity implements View.OnClickListener {

    private static final String TAG = MainActivity.class.getSimpleName();

    /**
     * Called when the activity is first created.
     */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.intro_new);

        findViewById(R.id.start_new_game_button).setOnClickListener(this);
    }

    @Override
    public void onClick(View v) {
        final EditText playerName = (EditText) findViewById(R.id.new_player_name);
        final Intent i = new Intent(this, MainActivity.class);
        i.putExtra(MainActivity.PLAYER_NAME, playerName.getText().toString());
        i.putExtra(MainActivity.NEW_GAME_FLAG, "true");
        startActivity(i);
    }

    @Override
    protected void onPause() {
        super.onPause();

        // Remove this activity from the stack.
        this.finish();
    }
}